<?php
namespace app\common\model;

use think\Model;
use think\model\concern\SoftDelete;

class Message extends Model
{
	use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $defaultSoftDelete = 0;
    protected $autoWriteTimestamp = true;

    protected function user()
    {
        return self::belongsTo(User::class, 'user_id')->bind(['user_name'=>'name']);
    }

    public static function getMessageList($where = 0)
    { 
        return self::with('user')->whereOr($where)->order('id desc')->paginate();
    }
    
}